import { Message } from '@shares/message/message'

const hp = ui.
    findChildByName('box')!.
    findChildByName('HP')!.
    findChildByName<UiText>('text-1')!

const gun = ui.
    findChildByName('box')!.
    findChildByName<UiText>('text-1')!

const image = ui.
    findChildByName('box')!.
    findChildByName<UiImage>('gun')!

remoteChannel.onClientEvent<Message<'HP'>>(({data,type}) => {
    if(type != 'HP') return
    hp.textContent = String(data)
})

remoteChannel.onClientEvent<Message<'gun'>>(({data,type}) => {
    if(type != 'gun') return
    gun.textContent = data.text
    image.image = data.image
})